﻿Public Class GradientOperation
    Inherits ImageOperationBase
    Private _color As Color
    Private _color2 As Color
    Public Sub New(ByVal Color As Color, ByVal Color2 As Color)
        _color = Color
        _color2 = Color2
    End Sub
    Public Overrides Sub ExecuteExtension(ByRef g As System.Drawing.Graphics, ByRef b As System.Drawing.Bitmap)
        Dim gradbrush As New LinearGradientBrush(New Rectangle(0, 0, b.Width, b.Height), _color, _color2, LinearGradientMode.Vertical)
        g.FillRectangle(gradbrush, New Rectangle(0, 0, b.Width, b.Height))
    End Sub
End Class
Public Class DarkenGradientOperation
    Inherits GradientOperation
    Public Sub New(ByVal Color As Color)
        MyBase.New(Color, RGBHSL.ModifyBrightness(Color, 0.9))
    End Sub
End Class
Public Class LightenGradientOperation
    Inherits GradientOperation
    Public Sub New(ByVal Color As Color)
        MyBase.New(Color, RGBHSL.ModifyBrightness(Color, 1.1))
    End Sub
End Class
Public Class VeryDarkGradientOperation
    Inherits GradientOperation
    Public Sub New(ByVal Color As Color)
        MyBase.New(Color, RGBHSL.ModifyBrightness(Color, 0.5))
    End Sub
End Class
Public Class VeryLightGradientOperation
    Inherits GradientOperation
    Public Sub New(ByVal Color As Color)
        MyBase.New(Color, RGBHSL.ModifyBrightness(Color, 1.5))
    End Sub
End Class
Public Class GlowFactory
    Public Shared Function GetGlowOperation(ByVal Color As Color, ByVal GlowMode As GlowMode) As ImageOperationBase
        Select Case GlowMode
            Case GlowMode.Darken
                Return New DarkenGradientOperation(Color)
            Case GlowMode.Lighten
                Return New LightenGradientOperation(Color)
            Case GlowMode.VeryDark
                Return New VeryDarkGradientOperation(Color)
            Case GlowMode.VeryLight
                Return New VeryLightGradientOperation(Color)
            Case GlowMode.Solid
                Return New GradientOperation(Color, Color)
            Case GlowMode.TopGlow
                Return New TopGlowOperation(Color)
            Case Business.GlowMode.Contrast
                Return New ContrastGlowOperation(Color)
            Case Else
                Return New GradientOperation(Color, RGBHSL.ModifyBrightness(Color, 1.3))
        End Select
    End Function
End Class